package com.sanyang.lawyer.controller.audit;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.sanyang.lawyer.ResultApi.CodeMsg;
import com.sanyang.lawyer.ResultApi.ResponseResult;
import com.sanyang.lawyer.entity.Audit;
import com.sanyang.lawyer.entity.Case_audit;
import com.sanyang.lawyer.mapper.audit.Audit_centerMapper;
import com.sanyang.lawyer.service.Audit.Audit_centerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("Audit_center")
public class Audit_centerController {
    
    @Autowired
    private Audit_centerService centerService;
    
    private ObjectMapper objectMapper = new ObjectMapper();
    
    //查询出所有的审核记录
    @RequestMapping("selectAuditAll")
    public ResponseResult<List<Case_audit>> selectAuditAll(String data){
        Case_audit audit = null;
        if(data!=null){
            try {
                audit = objectMapper.readValue(data, Case_audit.class);
            } catch (IOException e) {
                //错误返回服务器正忙错误
                ResponseResult.error(CodeMsg.SERVER_BUSY);
            }
        }
        return ResponseResult.success(centerService.selectAuditAll(audit));
    }
    
    
}
